package commands;

import nanoxml.XMLElement;
import utils.ITransmittable;

/**
 * This commands represents a request to the game's owner to
 * contact the DB and update the game's result.
 */
public class CommandGameResultToOwner implements ITransmittable {
	
	private final static String ATTR_WINNER_COLOR = "winnerColor";
	
	private String winnerColor = null; 
	
	public CommandGameResultToOwner (String winColor) {
		this.winnerColor = winColor;
		
	}
	public CommandGameResultToOwner (XMLElement command) {
		this.winnerColor = (String) command.getAttribute(ATTR_WINNER_COLOR);		
	}
	
	@Override
	public XMLElement toXML() {
		XMLElement message = new XMLElement();
		message.setName(Commands.GAME_RESULT_TO_OWNER);
		message.setAttribute(ATTR_WINNER_COLOR, winnerColor);		
		return message;
	}
	
	public String getWinnerColor()
	{
		return winnerColor;
	}
	
}
